package felix.actor.core;

import felix.actor.core.msg.TActorMsg;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Predicate;

public interface TActorSystem {

    ScheduledExecutorService getScheduler();

    void createDispatcher(String dispatcherId, ExecutorService executor);

    void destroyDispatcher(String dispatcherId);

    TActorRef getActor(TActorId actorId);

    TActorRef createRootActor(String dispatcherId, TActorCreator creator);

    TActorRef createChildActor(String dispatcherId, TActorCreator creator, TActorId parent);

    void tell(TActorId target, TActorMsg actorMsg);

    void tellWithHighPriority(TActorId target, TActorMsg actorMsg);

    void stop(TActorRef actorRef);

    void stop(TActorId actorId);

    void stop();

    void broadcastToChildren(TActorId parent, TActorMsg msg);

    void broadcastToChildren(TActorId parent, Predicate<TActorId> childFilter, TActorMsg msg);

    List<TActorId> filterChildren(TActorId parent, Predicate<TActorId> childFilter);
}
